# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: stef <l0ls0fo2i@ctrlc.hu>
# Contributor: Jose-Luis Rivas <ghostbar@riseup.net>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=radare2
pkgver=4.5.0
pkgrel=0
pkgdesc="An opensource, crossplatform reverse engineering framework"
url="http://www.radare.org"
arch="all"
license="GPL-3.0"
options="!check" # upstream does not provide any working testsuite
makedepends="$depends_dev libzip-dev openssl-dev capstone-dev linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/radare/radare2/archive/$pkgver.tar.gz"

# secfixes:
#   3.9.0-r0:
#     - CVE-2019-14745
#     - CVE-2019-12865
#     - CVE-2019-12829
#     - CVE-2019-12802
#     - CVE-2019-12790

build() {
	[ "$CARCH" = "s390x" ] && _disable_debugger="--disable-debugger"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		$_disable_debugger \
		--with-syscapstone \
		--with-openssl \
		--with-syszip
	make HAVE_LIBVERSION=1
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="84d4ffc28f499f4360f57f31ad1b1f4b2a14e7fcbde7198bfb9ec4a85ac6606ceb5b28602624d6419b14b1586afd50330ace6232a183d7bfb876fefe07ea7bf4  radare2-4.5.0.tar.gz"
